#include "Connect.h"

Connect::Connect(string url, string username, string passwd, string dbname)
{
    this->driver=sql::mysql::get_driver_instance();
    this->m_conn=this->driver->connect(url, username, passwd);
    this->m_conn->setSchema(dbname);
}

Connect::~Connect()
{
    if(this->m_conn)
    {
        this->m_conn->close();
    }
}

Connection *Connect::getConnection()
{
    if(m_conn)
    {
        return m_conn;
    }
    return nullptr;
}
